$(document).ready(function() {
	$(".son_ul").hide();
	var jobChoice=[
    	{name:"A",kind:"1",sort:"1",country:[{countryName:"Afghanistan"},{countryName:"Afghanistan"}]},
        {name:"B",kind:"1",sort:"2",country:[{countryName:"Bfghanistan"},{countryName:"Bfghanistan"}]},
        {name:"C",kind:"1",sort:"3",country:[{countryName:"Cfghanistan"},{countryName:"Cfghanistan"}]},
        {name:"D",kind:"1",sort:"4",country:[{countryName:"Dfghanistan"},{countryName:"Dfghanistan"}]},
        {name:"E",kind:"2",sort:"1",country:[{countryName:"Efghanistan"},{countryName:"Efghanistan"}]},
        {name:"F",kind:"2",sort:"2",country:[{countryName:"Ffghanistan"},{countryName:"Rfghanistan"}]},
        {name:"G",kind:"2",sort:"3",country:[{countryName:"Gfghanistan"},{countryName:"Gfghanistan"}]},
        {name:"H",kind:"2",sort:"4",country:[{countryName:"Hfghanistan"},{countryName:"Hfghanistan"}]},
        {name:"I",kind:"2",sort:"5",country:[{countryName:"Ifghanistan"},{countryName:"Ifghanistan"}]},
        {name:"J",kind:"3",sort:"1",country:[{countryName:"Jfghanistan"},{countryName:"Jfghanistan"},{countryName:"Jfghanistan"}]},
        {name:"K",kind:"3",sort:"2",country:[{countryName:"Kfghanistan"},{countryName:"Kfghanistan"}]},
        {name:"L",kind:"3",sort:"3",country:[{countryName:"Lfghanistan"},{countryName:"Lfghanistan"}]},
        {name:"M",kind:"3",sort:"4",country:[{countryName:"Mfghanistan"},{countryName:"Mfghanistan"}]},
        {name:"N",kind:"3",sort:"5",country:[{countryName:"Nfghanistan"},{countryName:"Nfghanistan"}]},
        {name:"O",kind:"4",sort:"1",country:[{countryName:"Ofghanistan"},{countryName:"Ofghanistan"}]},
        {name:"P",kind:"4",sort:"2",country:[{countryName:"Pghaninstan"},{countryName:"Pfghanistan"}]},
        {name:"Q",kind:"4",sort:"3",country:[{countryName:"Qfghanistan"},{countryName:"Qfghanistan"}]},
        {name:"R",kind:"4",sort:"4",country:[{countryName:"Rfghanistan"},{countryName:"Rfghanistan"}]},
        {name:"S",kind:"4",sort:"5",country:[{countryName:"Sfghanistan"},{countryName:"Sfghanistan"}]},
        {name:"T",kind:"5",sort:"1",country:[{countryName:"Tfghanistan"},{countryName:"Tfghanistan"}]},
        {name:"U",kind:"5",sort:"2",country:[{countryName:"Ufghanistan"},{countryName:"Ufghanistan"}]},
        {name:"V",kind:"5",sort:"3",country:[{countryName:"Vfghanistan"},{countryName:"Vfghanistan"}]},
        {name:"W",kind:"5",sort:"4",country:[{countryName:"Wfghanistan"},{countryName:"Wfghanistan"}]},
        {name:"X",kind:"5",sort:"5",country:[{countryName:"Xfghanistan"},{countryName:"Xfghanistan"}]},
        {name:"Y",kind:"5",sort:"6",country:[{countryName:"Yfghanistan"},{countryName:"Yfghanistan"}]},
        {name:"Z",kind:"5",sort:"7",country:[{countryName:"Zfghanistan"},{countryName:"Zfghanistan"},{countryName:"Zfghanistan"},{countryName:"Zfghanistan"},{countryName:"Zfghanistan"},{countryName:"Zfghanistan"},{countryName:"Zfghanistan"},{countryName:"Zfghanistan"},{countryName:"Zfghanistan"},{countryName:"Zfghanistan"},{countryName:"Zfghanistan"},{countryName:"Zfghanistan"},{countryName:"Zfghanistan"}]}
    ];
	
	//	页面上来之后立刻加载ABCD下面的内容
	var itemtext="ABCD";
	var itemname=1;	
	var putchoiceHtml="";
	requestChoice(itemtext,itemname);

	$(".zimu p").click(function(){		
		//存放各个国家的html
		putchoiceHtml="";
		itemtext=$(this).text()
		$(".chooseitem_lyc").empty();		
		itemname=$(this).attr('name');			
		requestChoice(itemtext,itemname)
	})
//	获取国家名称的方法
	function requestChoice(itemtext,itemname){
	$(".chooseitem_lyc").empty();				
	for(var i=0;i<itemtext.length;i++){
		putchoiceHtml="";			
		for(var k=0;k<jobChoice.length;k++){	
			if(jobChoice[k].sort==i+1){
				for(var j=0;j<jobChoice[k].country.length;j++){
					if(jobChoice[k].kind==itemname){					
						putchoiceHtml+='<p class="contury">'+jobChoice[k].country[j].countryName+'</p>';	
					}
				}	
			}
						
		}			
		var choose_html='<div class="chooseKind clearfix">'
		+'<div class="chooseMark">'+itemtext.substring(i,i+1)+'</div>'
		+'<div class="chooseMark2">'
		+putchoiceHtml
		+'</div>'	
		+'</div>'			
		$(".chooseitem_lyc").append(choose_html);
	}
}


	

	
})

//click
$(".zimu p").live('click', function() {
	$(this).siblings().css({
		'border-bottom': '2.5px solid #cccccc',
		'color': '#333333'
	})
	$(this).css({
		'border-bottom': '2.5px solid red',
		'color': 'red'
	})
})
$(".sz_t3 .contury").live('click', function() {
	//热门意向地变灰，并且将markred去掉			
	$(".sz_t .rmyxd .cscontent").css({
		"background-color": "transparent",
		"color": "#333333"
	});
	$(".sz_t .rmyxd .cscontent").removeClass('markred');

	$(".sz_t3 .contury").css({
		"background-color": "transparent",
		"color": "#333333"
	});
	$(this).css({
		"background-color": "#de3435",
		"color": "white"
	});
})
$(".sz_t .rmyxd .cscontent").live('click', function() {
	$(this).addClass('markred');
	$(".sz_t3 .contury").css({
		"background-color": "transparent",
		"color": "#333333"
	});
	$(this).css({
		"background-color": "#de3435",
		"color": "white"
	});
})
$(".sz_t .rmyxd .cscontent").hover(function() {
	$(this).css({
		"background-color": "#de3435",
		"color": "white"
	});
}, function() {
	if($(".sz_t .rmyxd .cscontent").attr('class').indexOf('markred') == -1) {
		$(this).css({
			"background-color": "transparent",
			"color": "#333333"
		});
	}
});
//开始填写简历
$(".startgoto").live('click', function() {
	var jianchachoose = false;
	$(".sz_t3 .contury").each(function() {
		if($(this).css('color') == 'white') {
			jianchachoose = true;
		}
	})
	if($(".sz_t .rmyxd .cscontent").css('color') != 'white' && !jianchachoose) {
		//如果一个都没有选中,出现弹层
		$(".selectJobCont ").show();
	}
})
//关闭弹层
$(".dialog .zycloseBtn,.dialog .zysubmit").live('click', function() {
	$(".selectJobCont").hide();
})